﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.Model;
using Automobile.service.BLL;

namespace Automobile.service.UI
{
    public partial class AddDocument : System.Web.UI.Page
    {
        DocumentBll bll = new DocumentBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }        

        protected void butBack(object sender, EventArgs e)
        {
             Response.Redirect("Document.aspx");
        }

        protected void ButAdd(object sender, EventArgs e)
        {
            DocumentModel docu = new DocumentModel();
            docu.Document_Type_Name = this.TextBox1.Text.ToString();
            docu.WareHose_Id = Convert.ToInt32(this.TextBox2.Text);
            docu.Document_Date = DateTime.Parse(this.TextBox3.Text.ToString());
            docu.Employee_Id = Convert.ToInt32(this.TextBox4.Text.ToString());
            docu.Document_Remark = this.TextBox5.Text.ToString();
            if (bll.AddDocument(docu) > 0)
            {
                Response.Write("<script>alert('添加成功!');location.href='Document.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');</script>");
            }
        }
    }
}